<!--
* description: 竞品车型
* author: liks
* createdDate: 2020-03-05
-->
<template>
  <section class="carTypeConfig">
    <el-dialog v-dialogDrag
      title="竞品车型"
      :visible.sync="curPopupsVisible"
      width="1000px"
      center
      @close="sendCode"
      :close-on-click-modal="false"
      :append-to-body="true"
    >
      <dialogHeader
        slot="title"
        :title="'竞品车型'"
        :styleType="$store.state.app.dialogType"
      ></dialogHeader>
      <one-table-template
        ref="multipleTable"
        :dynamicButtons="tableButtons"
        :dynamicComponents="tableComponents"
        :dynamicApiConfig="apiConfig"
        :dynamicTableCols="tableCols"
        :dynamicFormFields="formField"
        :dynamicIsShowSelect="isMul"
      />
    </el-dialog>
  </section>
</template>
<script>
import { oneTableWithViewTemplateMixins } from '@/components/mixins/oneTableWithViewTemplateMixins';
import { valueObjectMixins } from '@/components/mixins/valueObjectMixins';
import { crmApis } from "@/api/apiList/crm";
import OneTableTemplate from "@/components/crm/commonComponents/crmPopupsOneTable";
export default {
  // 组件混入对象：{data[listQuery] methods[queryTable]}
  mixins: [oneTableWithViewTemplateMixins, valueObjectMixins],
  components: {
    OneTableTemplate,
    dialogHeader: () => import("@/components/dialogHeader") //弹窗标题
  },
  data() {
    return {
      // 网格查询API配置对象
      apiConfig: crmApis.mdmCompCarTypeQueryNewFindAll,
      // 动态组件-按钮
      tableButtons: [
        {
          compKey: "btnKey1",
          type: "primary",
          size: "small",
          clickEvent: () => this.queryTable(1),
          text: "查询",
          position: "top"
        },
        {
          compKey: "btnKey2",
          type: "primary",
          size: "small",
          clickEvent: () => this.sendCode("compCartypeCode", "compCartypeCn"),
          text: "确认",
          position: "bottom"
        },
        {
          compKey: "btnKey3",
          type: "",
          size: "small",
          clickEvent: () => this.reset(),
          text: "重置",
          position: "top"
        }
      ],
      // 动态组件-查询条件
      tableComponents: [
        // 显示组件
        {
          compKey: "compKey1",
          labelName: "竞品品牌",
          codeField: "compBrandCode",
          textField: "compBrandCn",
          lookuptype: crmApis.mdmCompBrandQueryFindAll,
          component: () =>
          import("@/components/crm/lookupValue/singleDropList"),
          type: "dropdownList",
          isMust: false,
          isMul:false,
          filterable:true
        },
        {
          compKey: "compBrandCode",
          labelName: "竞品车系",
          codeField: "compCarseriesId",
          textField: "compCarseriesName",
          lookuptype: crmApis.mdmCompCarSeriesQueryFindAll,
          changeCodeArray: [
          { changCode:"compBrandCode" }
        ],
        component: () =>
          import("@/components/crm/lookupValue/secondDropList"),
          type: "dropdownList",
          isMust: false,
          isMul:false,
        },
        {
          compKey: "compKey3",
          labelName: "竞品车型名称",
          codeField: "compCartypeCn",
          component: () =>import("@/components/crm/textbox/crmTextInput"),
          type: "inputText",
          isMust: false,
        },
      ],
      // 动态生成网格列
      tableCols: [
        {
          prop: "compBrandCn",
          label: "竞品品牌",
          width: null,
          align: "center"
        },
        {
          prop: "compCarseriesName",
          label: "竞品车系",
          width: null,
          align: "center"
        },
        {
          prop: "compCartypeCn",
          label: "竞品车型名称",
          width: null,
          align: "center"
        },
        {
          prop: "compCartypeCode",
          label: "竞品车型编码",
          width: null,
          align: "center"
        },
      ],
      //表单查询数据（查询条件）
      formField: {
        compBrandCode:"",
        compCarseriesId:"",
        compCartypeCn:"",
        isEnable:"1",
      },
      handleTableRowData: {
        value: "compCartypeCode",
        text: "compCartypeCn"
      }
    };
  }
};
</script>
